<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class site
{
    public $settings = array();
    
    public function __construct()
    {
        if (!isset($this->CI))
        {
            $this->CI =& get_instance();
        }
		
        //$this->CI->load->library('user_agent');
        //$this->get_site_info();
    }
	 
    public function load($page, $data = NULL, $layout=FALSE)
    {
        $data['page'] = $page;

        if($layout==TRUE){
            $this->CI->load->view('html/skin_'.$layout, $data);
        }else{
            $this->CI->load->view('html/skin', $data);
        }        
    }
  
    public function load_login($page, $data = NULL, $layout=FALSE)
    {
        $data['page'] = $page;

        if($layout==TRUE){
            $this->CI->load->view('html/skin_login_'.$layout, $data);
        }else{
            $this->CI->load->view('html/skin_login', $data);
        }        
    }
    
	
    // Get Templates Active
    public function get_default_template()
    {
        $this->CI->db->select('duongdan');
        $this->CI->db->where('kichhoat', '1');
        
        $query = $this->CI->db->get('giaodien', 1);
        
        if ($query->num_rows() == 1)
        {
            $row = $query->row_array();
        }
        
        return $row['duongdan'];
    }
    
    public function get_default_language()
    {
        $this->CI->db->select('language');
        $this->CI->db->where('is_default', '1');
        
        $query = $this->CI->db->get($this->_table['languages'], 1);
        
        if ($query->num_rows() == 1)
        {
            $row = $query->row_array();
        }
        
        return $row['language'];
    }
    
    public function get_site_info()
    {
        /*
        $this->CI->db->select('name, value');
        
        $query = $this->CI->db->get($this->_table['settings']);
        
        if ($query->num_rows() > 0)
        {
            $result = $query->result_array();

            foreach ($result as $row)
            {
                $this->settings[$row['name']] = $row['value'];
            }
        }
        */
    }
    
    public function check_site_status()
    {
        /*
        $this->CI->db->select('name, value');
        $this->CI->db->where('name', 'enabled');
        
        $query = $this->CI->db->get($this->_table['settings'], 1);
        
        if ($query->num_rows() == 1)
        {
            $result = $query->row_array();
            
            if ($result['value'] == 0)
            {
                $data['offline_reason'] = $this->settings['offline_reason'];
                
                $this->CI->load->view('admin/layout/pages/offline', $data);
                die();
            }
        }
        */
    }


}

?>